package com.ticketbox.web.servlets;

import java.io.IOException;

import javax.ejb.EJB;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.ticketbox.ejb.session.UserBean;
import com.ticketbox.web.util.ActionsUtil;

@WebServlet(name="/processServlet", urlPatterns = {"/ProcessServlet"}, loadOnStartup=1)
public class ProcessServlet extends HttpServlet{

	/**
	 * serialVersionUID
	 */
	private static final long serialVersionUID = 8657423036831860497L;
	
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		super.doPost(req, resp);
		/**
		 * Retrieves the action 
		 */
		String action = req.getParameter("action");
		if(action.equals(ActionsUtil.USER_LOGIN)){
			
		}
	}
	
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		super.doGet(req, resp);
		/* Forwards all the get requests to doPost method*/
		doPost(req, resp);
	}
	
	/**
	 * Authenticates a user
	 * @param req HttpServletRequest object
	 * @param resp HttpServletResponse object
	 * @throws ServletException
	 * @throws IOException
	 */
//	@EJB
//	UserBean userBean;
	public void authenticate(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
	}
}
